﻿using System.Collections;
using System.Collections.Specialized;
using VitCode.Castle.Entities;

namespace AMS.Core.Entities
{
    public class BarcodeFormat : BaseEntity
    {
        private string m_AssetTypeName;
        private string m_Prefix;
        private bool m_IsEnableDate;
        private int m_NumLength;

        /// <summary>
        /// 资产类型
        /// </summary>
        public virtual string AssetTypeName
        {
            get { return m_AssetTypeName; }
            set { m_AssetTypeName = value; }
        }

        /// <summary>
        /// 标签前缀
        /// </summary>
        public virtual string Prefix
        {
            get { return m_Prefix; }
            set { m_Prefix = value; }
        }

        /// <summary>
        /// 是否启用日期
        /// </summary>
        public virtual bool IsEnableDate
        {
            get { return m_IsEnableDate; }
            set { m_IsEnableDate = value; }
        }


        /// <summary>
        /// 流水号位数
        /// </summary>
        public virtual int NumLength
        {
            get { return m_NumLength; }
            set { m_NumLength = value; }
        }


        /// <summary>
        /// 重写Equals方法
        /// </summary>
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(obj, this))
                return true;
            if (obj == null)
                return false;
            var sObj = obj as BarcodeFormat;
            return sObj != null && (sObj.Id == m_Id);
        }

        /// <summary>
        /// 重写GetHashCode方法
        /// </summary>
        public override int GetHashCode()
        {
            int hash = 177;
            hash = 17*hash*m_Id.GetHashCode();
            return hash;
        }

        public ArrayList GetRelateObjectInfo()
        {
            var al = new ArrayList();
            al.Add(new string[] { typeof(AssetInfo).Name, "o.BarcodeFormat.Id='" + m_Id + "'", m_AssetTypeName });
            return al;
        }
    }
}